#include<iostream>
#include<vector>
#include<assert.h>

#define MS 10

using namespace std;


struct win_t{
    int x1;
    int y1;
    int x2;
    int y2;
};

struct point_t{
    int x;
    int y;
};

inline int check(){
    
}

int main(){
    vector<win_t> wins;
    vector<point_t> points;
    vector<int> winnos;

    int N, M;
    cin >> N;
    cin >> M;
    for(int i=0;i<N;i++){
        wins.push_back(win_t());
        assert(wins.size() == i+1);
        cin >> wins[i].x1;
        cin >> wins[i].y1;
        cin >> wins[i].x2;
        cin >> wins[i].y2;
        winnos.push_back(int());
        winnos[i]=i;
    }
    for(int i=0;i<M;i++){
        points.push_back(point_t());
        cin >> points[i].x;
        cin >> points[i].y;     
    }

    for(auto point:points){
        int i=N-1;
        int winno = -1;
        for(;i >=0;i--){
            winno = winnos[i];
            auto win = wins[winno];
            if(win.x1 <= point.x && win.y1 <= point.y && win.x2 >= point.x && win.y2 >= point.y){
                for(int j = i;j<N-1;j++){
                    winnos[j]=winnos[j+1];                    
                }
                winnos[N-1] = winno;
                break;
            }
        }
        if(i==-1){
            cout << "IGNORED";
        }
        else{
            cout << winno + 1;
        }
        cout<< endl;
    }
    return 0;
}